/**
 * Created by zangyin on 16/6/6.
 */

import React, {Component, PropTypes} from 'react';
import {View, StatusBar, Navigator} from 'react-native';

import CustomNavigator from '../plugin/MIFNavigator'

export default class CCNavigator extends Component {
  render() {

    let {rootComponent} = this.props;
    let defaultName = rootComponent.name;
    let defaultComponent = rootComponent;

    return (

      <CustomNavigator ref={(ref) => {
        this.nav = ref
      }} initialRoute={{
        name: defaultName,
        component: defaultComponent
      }} {...this.props} configureScene={(route) => {
        return Navigator.SceneConfigs.PushFromRight;
      }} renderScene={(route, navigator) => {
        let Component = route.component;
        return <Component
                {...route.params}
                {...this.props}
                navigator={navigator}/>
      }}/>
    );
  }
}

// CCNavigator.propTypes = {
//   rootComponent: PropTypes.element.isRequired,
// }
